package com.iamteer.a_filter_hello;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
//import javax.servlet.annotation.WebFilter;
/**
 * 过滤器测试
 * @author Chuck
 *
 */
//@WebFilter("/*")
public class HelloFilter2 implements Filter {

	// 创建实例
	public HelloFilter2() {
	}
	
	@Override
	public void init(FilterConfig arg0) throws ServletException {
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
			throws IOException, ServletException {
		System.out.println("过滤器二：2.  执行过滤器业务处理方法");
		// 放行，到 servlet
		arg2.doFilter(arg0, arg1);
		//回来
		System.out.println("过滤器二：4. servlet 处理完成，又回到过滤器");
	}

	@Override
	public void destroy() {
	}
}
